%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% All whales pull rainy, cold girls.
% Death, life, and desolation.
% The sea grows like a warm sun.
% Where is the stormy sailor?
% Golly gosh, death!

\documentclass{l3deliverable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{graphicx}%
%
\usepackage{svn-multi}%
\svnid{$Id: d8\_4.tex 2500 2011-09-21 15:56:43Z tws $}

\version{78}

\usepackage{tabularx}%
\usepackage{url}%
\ifx\pdftexversion\undefined
\usepackage[dvips]{graphicx}
\else
\usepackage[pdftex]{graphicx}
\DeclareGraphicsRule{*}{mps}{*}{}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Check these macro values for appropriateness for your own document.

\title{Maintenance Report}
\titlesmall{Maintenance Report}
\author{
  Daniel Callander \\
  Agnieszka Kielbinska \\
  Stephen McQuistin \\
  David Newall \\
  Ian Scott}

\date{5 March 2012}

\deliverableID{D8.4}
\project{PSD3 Group Exercise 2}
\team{K}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\maketitle

\tableofcontents

\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Standard section for all documents

\section{Introduction}

\subsection{Identification}

This is Team K's Maintenance Report for the DemoSOCS project.

\subsection{Related Documentation}

\begin{description}
  \item[Group Exercise 2 overview document] \hfill \\
	\url{http://fims.moodle.gla.ac.uk/mod/resource/view.php?id=18599}
  \item[Group Exercise 2 DemoSOCS Requirements Specification] \hfill \\
  \url{http://fims.moodle.gla.ac.uk/mod/resource/view.php?id=18596}
  \item[Group Exercise 2: D8.4] \hfill \\
	\url{http://fims.moodle.gla.ac.uk/file.php/128/ge-2-d8.4-rev2927.pdf}
\end{description}

\subsection{Purpose and Description of Document}

The purpose of this document is to detail the changes made to our system design and specification as a result of the requirements changes outlined in the document referenced above.

\subsection{Document Status and Schedule}

This is release 32, dated 4/3/12. This is the final redraft of this document, and no further edits are planned.

\section{System design changes}

To test the maintainability of our voting system we were tasked with extending the types of election supported. Originally, all elections used the simple plurality system, where the candidates with the most votes wins. The voting system had to be changed to allow alternative vote and referenda elections to also be created. 

\subsection{General changes}
A new facade was provided to implement these changes. The main difference was with how votes were cast, 'Options' have replaced candidates. This supports other election types such as referenda where what you are voting for may not be a candidate, but a yes or no option instead. This also lets Alternative Vote elections be created, where voters rank the candidates as opposed to giving 1 vote. Candidates extend options so that simple plurality elections are still possible.

\subsection{Changes to accommodate alternative voting}
In order to accomodate the requirement for an alternative voting kind of election a number of modifications have been made to the system. \newline
A new class called RankedVote has been created to represent the alternative voting (AV) election as opposed to the plurality election. The RankedVote constructor takes, as a parameter, a listing of strings order in the preference for the vote.\newline
\newline
In addition, ElectionImpl class has been modified so that it now has the "Set<RankedVotes> rankedVotes" attribute to store the ranked votes. The constructor now initiates the rankedVotes attribute and there is a "get" method to return rankedVotes. Furthermore, there is a function to add votes to RankedVotes, which should be used instead of the addVote function when the election is of the type "AV".\newline
\newline
Also, VotingSystemImpl class has been changed in order to distinguish between two types of elections. When the election has type "AV" then publishResults function uses Util.computeAVResult to calculate the AV result from the votes. Such result is then converted into a list of Options so that an ElectionResult can be created. After that the function continues in an ordinary manner, setting the ElectionResult as expected. Moreover, if the type of an election is "AV" then the castVote function will cast the Vote to a RankedVote and it will use addRankedVote method rather than addVote.\newline
\newline
Finally, CastVoteCommand has been modified so that when an election is of the type "AV" it creates RankedVote vote instead of OneOfNVoteStub vote and prints out the vote in a slightly different way.\newline
\subsection{Changes to accommodate referenda}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
